<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Doxygen: Metrics::HistIntersectionUnionDistance&lt; T &gt; 模板结构体 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Doxygen
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('struct_metrics_1_1_hist_intersection_union_distance.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-types">Public 类型</a> &#124;
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="struct_metrics_1_1_hist_intersection_union_distance-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">Metrics::HistIntersectionUnionDistance&lt; T &gt; 模板结构体 参考</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public 类型</h2></td></tr>
<tr class="memitem:a0938177cf605837f942bb9044f1747ed"><td class="memItemLeft" align="right" valign="top"><a id="a0938177cf605837f942bb9044f1747ed"></a>
typedef T&#160;</td><td class="memItemRight" valign="bottom"><b>ElementType</b></td></tr>
<tr class="separator:a0938177cf605837f942bb9044f1747ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad2d68d121d0908c081ea26e869779cdf"><td class="memItemLeft" align="right" valign="top"><a id="ad2d68d121d0908c081ea26e869779cdf"></a>
typedef <a class="el" href="struct_metrics_1_1_accumulator.html">Accumulator</a>&lt; T &gt;::Type&#160;</td><td class="memItemRight" valign="bottom"><b>ResultType</b></td></tr>
<tr class="separator:ad2d68d121d0908c081ea26e869779cdf"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a92e27e4fce4c1c6fa8fa31cec9c7329b"><td class="memTemplParams" colspan="2">template&lt;typename Iterator1 , typename Iterator2 &gt; </td></tr>
<tr class="memitem:a92e27e4fce4c1c6fa8fa31cec9c7329b"><td class="memTemplItemLeft" align="right" valign="top">ResultType&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="struct_metrics_1_1_hist_intersection_union_distance.html#a92e27e4fce4c1c6fa8fa31cec9c7329b">operator()</a> (Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist=-1) const</td></tr>
<tr class="separator:a92e27e4fce4c1c6fa8fa31cec9c7329b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00eb885d15772f25cfc44e6d073bb123"><td class="memTemplParams" colspan="2">template&lt;typename U , typename V &gt; </td></tr>
<tr class="memitem:a00eb885d15772f25cfc44e6d073bb123"><td class="memTemplItemLeft" align="right" valign="top">ResultType&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="struct_metrics_1_1_hist_intersection_union_distance.html#a00eb885d15772f25cfc44e6d073bb123">accum_dist</a> (const U &amp;a, const V &amp;b, int dim) const</td></tr>
<tr class="separator:a00eb885d15772f25cfc44e6d073bb123"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">成员函数说明</h2>
<a id="a00eb885d15772f25cfc44e6d073bb123"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a00eb885d15772f25cfc44e6d073bb123">&#9670;&nbsp;</a></span>accum_dist()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<div class="memtemplate">
template&lt;typename U , typename V &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ResultType <a class="el" href="struct_metrics_1_1_hist_intersection_union_distance.html">Metrics::HistIntersectionUnionDistance</a>&lt; T &gt;::accum_dist </td>
          <td>(</td>
          <td class="paramtype">const U &amp;&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const V &amp;&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>dim</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Partial distance, used by the kd-tree. </p>
<div class="fragment"><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        {</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;          <span class="comment">//printf(&quot;New code being used, accum_dist\n&quot;);</span></div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;          ResultType min0;</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;          ResultType max0;</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;          min0 = (a &lt; b ? a : b) + 1.0;</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;          max0 = (a &gt; b ? a : b) + 1.0;</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;          <span class="keywordflow">return</span> (1 - (min0 / max0));</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;          <span class="comment">//return (a+b-2*(a&lt;b?a:b));</span></div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;        }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a92e27e4fce4c1c6fa8fa31cec9c7329b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a92e27e4fce4c1c6fa8fa31cec9c7329b">&#9670;&nbsp;</a></span>operator()()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<div class="memtemplate">
template&lt;typename Iterator1 , typename Iterator2 &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ResultType <a class="el" href="struct_metrics_1_1_hist_intersection_union_distance.html">Metrics::HistIntersectionUnionDistance</a>&lt; T &gt;::operator() </td>
          <td>(</td>
          <td class="paramtype">Iterator1&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Iterator2&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">ResultType&#160;</td>
          <td class="paramname"><em>worst_dist</em> = <code>-1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Compute a distance between two vectors using (1 - (1 + sum(min(a_i,b_i))) / (1 + sum(max(a_i, b_i))) )</p>
<p>This distance is not a valid kdtree distance, it's not dimensionwise additive and ignores worst_dist parameter. </p>
<div class="fragment"><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        {</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;          (void)worst_dist;</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;          ResultType result = ResultType ();</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;          ResultType min0, min1, min2, min3;</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;          ResultType max0, max1, max2, max3;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;          Iterator1 last = a + size;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;          Iterator1 lastgroup = last - 3;</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160; </div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;          ResultType sum_min, sum_max;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;          sum_min = 0;</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;          sum_max = 0;</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160; </div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;          <span class="keywordflow">while</span> (a &lt; lastgroup)</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;          {</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;            min0 = (a[0] &lt; b[0] ? a[0] : b[0]);</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;            max0 = (a[0] &gt; b[0] ? a[0] : b[0]);</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;            min1 = (a[1] &lt; b[1] ? a[1] : b[1]);</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;            max1 = (a[1] &gt; b[1] ? a[1] : b[1]);</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;            min2 = (a[2] &lt; b[2] ? a[2] : b[2]);</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;            max2 = (a[2] &gt; b[2] ? a[2] : b[2]);</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;            min3 = (a[3] &lt; b[3] ? a[3] : b[3]);</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;            max3 = (a[3] &gt; b[3] ? a[3] : b[3]);</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;            sum_min += min0 + min1 + min2 + min3;</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;            sum_max += max0 + max1 + max2 + max3;</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;            a += 4;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;            b += 4;</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;            <span class="comment">/*if (worst_dist&gt;0 &amp;&amp; result&gt;worst_dist) {</span></div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;<span class="comment">             return result;</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="comment">             }*/</span></div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;          }</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160; </div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;          <span class="keywordflow">while</span> (a &lt; last)</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;          {</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;            min0 = *a &lt; *b ? *a : *b;</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;            max0 = *a &gt; *b ? *a : *b;</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;            sum_min += min0;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;            sum_max += max0;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;            a++;</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;            b++;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;            <span class="comment">//std::cout &lt;&lt; a &lt;&lt; &quot; &quot; &lt;&lt; last &lt;&lt; std::endl;</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;          }</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160; </div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;          result = <span class="keyword">static_cast&lt;</span>ResultType<span class="keyword">&gt;</span> (1.0 - ((1 + sum_min) / (1 + sum_max)));</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;          <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        }</div>
</div><!-- fragment -->
</div>
</div>
<hr/>该结构体的文档由以下文件生成:<ul>
<li>apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/<a class="el" href="metrics_8h_source.html">metrics.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>Metrics</b></li><li class="navelem"><a class="el" href="struct_metrics_1_1_hist_intersection_union_distance.html">HistIntersectionUnionDistance</a></li>
    <li class="footer">制作者 <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
